Updated: Dec 4, 20243 min read

Coral AI Person Detection with Home Assistant & Frigate

Written by: Fixt
Coral TPU Acelerator

Using the affiliate links below helps support the channel and all the content I create 🎉🙌

Prerequisites

Frigate Full Access Add-On

By blakeblackshear

Open your Home Assistant instance and show the dashboard of a Supervisor add-on.

Frigate Integration

By blakeblackshear

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Frigate Card

By dermotduffy

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Mosquitto Broker Add-On

Open your Home Assistant instance and show the dashboard of a Supervisor add-on.

Configuration

Base frigate.yaml configuration file

homeassistant/frigate.yml

detectors:
  coral:
    type: edgetpu
    device: usb
 
mqtt:
  host: homeassistant.local
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: #your mqtt user
  password: #your mqtt password
  stats_interval: 60
      
cameras:
  #simple camera example
  entrance:
    ffmpeg:
      inputs:
        - path: rtsp://user:password@ip:port
          roles:
            - record
            - detect 
    detect: 
      height: 720
      fps: 5
 
record:
  enabled: True
  retain:
    days: 7
    mode: motion
  events:
    retain:
      default: 14
      mode: active_objects
 
ffmpeg:  
  hwaccel_args: preset-rpi-64-h264
 
objects: 
  track:
    - person
    - dog
    - cat  
  filters:
    person:
      # Optional: minimum width*height of the bounding box for the detected object (default: 0)
      min_area: 0
      # Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
      max_area: 100000
      # Optional: minimum score for the object to initiate tracking (default: shown below)
      min_score: 0.5
      # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below)
      threshold: 0.7

📖 FFmpeg pressets here

Advanced Camera Example

homeassistant/frigate.yml

#advanced camera example
livingroom:
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-aac
      inputs:
        - path: rtsp://user:password@ip-hi-res-stream:port
          roles:
            - record
        - path: rtsp://user:password@ip-low-res-stream:port
          roles:
            - detect
    detect:                
      height: 720
      fps: 5
    motion:
      mask:
        - 1280,0,1280,49,1123,0
    zones:
      fixt_desk:
        coordinates: 445,486,419,177,542,0,679,0,829,0,810,285,686,453,572,512
    snapshots:
      required_zones:
        - fixt_desk

Mobile Notifications Blueprint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

I would love to hear your comments, or suggestions on this post.


Avatar of Fixt

Fixt is a Software Engineer passionate about making the world a better place through technology and automation.